import { getCrudApi } from "@/utils/http/crud.ts";

export interface DictDto {
  name: string | null;
  code: string | null;
  remark?: string | null;
  weight: number;
  items?: DictItemDto[];
}

export interface DictItemDto {
  name: string | null;
  code: string | null;
  dictCode: string;
  remark?: string | null;
}

export default {
  ...getCrudApi<DictDto>("dict"),
};

export function dictItemApi(code: string) {
  return getCrudApi<DictItemDto>("dict/" + code + "/item");
}
